package com.shudai.largescreen.controller;

import com.shudai.largescreen.common.R;
import com.shudai.largescreen.service.OperatorAnalysisService;
import com.shudai.largescreen.service.RepurchaseAnalysisService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/api")
@Api(tags = "复购分析",value = "复购分析")
@RequiredArgsConstructor
public class RepurchaseController {

    private final RepurchaseAnalysisService repurchaseAnalysisService;

    @ApiOperation("总统计表")
    @PostMapping(value = "/repurchase-board/statics-total")
    public R getAllDeal() {
        return R.ok(repurchaseAnalysisService.getAllDeal());
    }

    @ApiOperation("业务员复购分析")
    @PostMapping(value = "/repurchase-board/salesman-repurchase")
    public R getSalesmanRepurchase(String province,String  region) {
        return R.ok(repurchaseAnalysisService.getSalesmanRepurchase(province,region));
    }

    @ApiOperation("团队复购分析")
    @PostMapping(value = "/repurchase-board/team-repurchase")
    public R getTeamRepurchase(String province,String  region,String teamName) {
        return R.ok(repurchaseAnalysisService.getTeamRepurchase(province,region,teamName));
    }


    @ApiOperation("团队客单价分析")
    @PostMapping(value = "/repurchase-board/team-customer-unit")
    public R getTeamCustomerUnit(String province,String  region) {
        return R.ok(repurchaseAnalysisService.getTeamCustomerUnit(province,region));
    }

    @ApiOperation("三个月未复购总汇&总复购客户")
    @PostMapping(value = "/no-repurchase-board/three-month-total")
    public R getThreeMonthTotal() {
        return R.ok(repurchaseAnalysisService.getThreeMonthTotal());
    }

    //NoRepurchaseTable
    @ApiOperation("业务员未复购分析")
    @PostMapping(value = "/no-repurchase-board/no-repurchase-table")
    public R getNoRepurchaseTable(String province,String  region) {
        return R.ok(repurchaseAnalysisService.getNoRepurchaseTable(province,region));
    }

    @ApiOperation("团队未复购分析")
    @PostMapping(value = "/no-repurchase-board/team-no-repurchase-table")
    public R getTeamNoRepurchaseTable(String province,String  region,String teamName) {
        return R.ok(repurchaseAnalysisService.getTeamNoRepurchaseTable(province,region,teamName));
    }


}
